package edu.ucsc.gameAI.conditions;

import edu.ucsc.gameAI.ICondition;
import pacman.game.Game;

public class PacmanInRegion implements ICondition{
	
	//The coordinate of the upper-left-hand corner of the region we care about.
	int x1;
	int y1; 
	
	//The coordinate of the lower-right-hand corner of the region w care about.
	int x2;
	int y2;

	public PacmanInRegion(int i, int j, int k, int l) {
		x1 = i;
		y1 = j;
		x2 = k;
		y2 = l;
	}

	public boolean test(Game game) {
		int pacManX = game.getNodeXCood(game.getPacmanCurrentNodeIndex());
		int pacManY = game.getNodeYCood(game.getPacmanCurrentNodeIndex());
		boolean returnValue = false; //assume that pacman is NOT in the region
		
		if(pacManX >= x1 && pacManX <= x2){ //pacman is in the horizontal boundaries
			if(pacManY >= y1 && pacManY <=y2){ //pacman is in the vertical boundaries
				returnValue = true;
			}
		}
		return returnValue;
	}

}
